<extend name="Public:innerbase" />
<block name="css">
<link rel="stylesheet" href="{:STATICS}/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{:STATICS}/kindeditor/plugins/code/prettify.css" />
<link rel="stylesheet" href="{:STATICS}/validation/css/validationEngine.jquery.css" />
<style>
	.form-horizontal .control-label{
		text-align:left;
	}
</style>
</block>
<block name="js">
<include file="Public:upload" />
<script type="text/javascript" src="{:STATICS}/validation/js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="{:STATICS}/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="{:STATICS}/js/holder.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{:STATICS}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{:STATICS}/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="{:STATICS}/ueditor/lang/zh-cn/zh-cn.js"> </script>
<script type="text/javascript">
	$('#category').change(function(){
		$('#category_name').val($(this).find('option:selected').text());
	});
	
	$(function(){
		$("#editForm").validationEngine("attach",{ 
			promptPosition:"centerRight",
			scroll:true,
			showOneMessage:true
		});
		var ue = UE.getEditor('content');
	});
</script>
</block>
<block name="content">
<div class="container">
	<div class="page-header">
		<h4>{$title}&nbsp;</h4>
		<if condition="$set['id']"><code><?php echo rtrim(C('wap_domain'),'/').U('Wap/Ski/video',['id'=>$set['id'],'token'=>session('token')]);?></code><br/></if>
		<a class="btn btn-sm btn-default" href="{:U('video',['p'=>$_GET['p'],'cate'=>$_GET['cate']])}">
			<span class="fa fa-chevron-left"></span>&nbsp;返回
		</a>
	</div>
	<form id="editForm" class="form-horizontal" role="form" action="" method="post">
		<input type="hidden" name="id" value="{$set.id}"/>
		<div class="form-group">
			<label for="title" class="col-sm-2 control-label">标题</label>
			<div class="col-sm-4">
				<input type="text" class="form-control validate[required]" id="title" name="title" value="{$set.title}" />
			</div>
		</div>
		<div class="form-group">
			<label for="category" class="col-sm-2 control-label">分类</label>
			<div class="col-sm-4">
				<select id="category" class="form-control" name="cate_id">
					<volist name="cates" id="category">
					<option value="{$category['id']}" <if condition="($category['id'] eq $set['cate_id'])">selected</if>>{$category['name']}</option>
					</volist>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label for="img" class="col-sm-2 control-label">图片</label>
			<div class="col-sm-6" >
				<input type="hidden" class="form-control" value="{$set.cover}" id="imgs" name="cover" />
				<img id="imgsHolder" style="width:240px;height:120px;" <if condition="!$set['cover']">data-src="$holder.js/196x120/gray/text:720*400"</if> src="{$set.cover}"/>
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('imgs',700,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('imgs')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label for="abstract" class="col-sm-2 control-label">摘要</label>
			<div class="col-sm-8">
				<textarea class="form-control" id="abstract" rows="4" name="abstract" >{$set['abstract']}</textarea>
			</div>
		</div>
		<div class="form-group">
			<label for="content" class="col-sm-2 control-label">正文</label>
			<div class="col-sm-10">
				<textarea id="content" style="height:420px;" name="detail" >{$set['detail']}</textarea>
			</div>
		</div>
		<div class="form-group">
			<label for="sort" class="col-sm-2 control-label">排序</label>
			<div class="col-sm-2">
				<input type="text" class="form-control validate[required,custom[integer]]" id="sort" name="sort" value="{$set.sort|default=1}" />
				<span class="help-block">1-255,值越大越靠前</span>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-primary">保存</button>
			</div>
		</div>
	</form>
</div>
</block>